package be.bonamis.timesheet.service;

import java.util.List;

import be.bonamis.timesheet.dto.ProjectDTO;
import be.bonamis.timesheet.model.Project;

/**
 * Declares methods used to obtain and modify project information.
 * @author Florent Bonamis
 */
public interface ProjectService {

    /**
     * Creates a new project.
     * @param created   The information of the created project.
     * @return  The created project.
     */
    public Project create(ProjectDTO created);

    /**
     * Deletes a project.
     * @param projectId  The id of the deleted project.
     * @return  The deleted project.
     * @throws ProjectNotFoundException  if no project is found with the given id.
     */
    public Project delete(Long projectId) throws ProjectNotFoundException;

    /**
     * Finds all projects.
     * @return  A list of projects.
     */
    public List<Project> findAll();

    /**
     * Finds project by id.
     * @param id    The id of the wanted project.
     * @return  The found project. If no project is found, this method returns null.
     */
    public Project findById(Long id);

    /**
     * Updates the information of a project.
     * @param updated   The information of the updated project.
     * @return  The updated project.
     * @throws ProjectNotFoundException  if no project is found with given id.
     */
    public Project update(ProjectDTO updated) throws ProjectNotFoundException;
}
